#include <stdio.h>

int Solitaire(int tab[7][7])
{
   int i,j,count=0;
   for ( i=0 ; i < 7 ; i++ ) {
      for ( j=0 ; j < 7 ; j++ ) {
         if ( i<5 )
            if ((tab[i][j] == 1) && (tab[i+1][j] == 1) && (tab[i+2][j] == 0)) count++;
         if ( i>1 )
            if ((tab[i][j] == 1) && (tab[i-1][j] == 1) && (tab[i-2][j] == 0)) count++;
         if ( j<5 )
            if ((tab[i][j] == 1) && (tab[i][j+1] == 1) && (tab[i][j+2] == 0)) count++;
         if ( j>1 )
            if ((tab[i][j] == 1) && (tab[i][j-1] == 1) && (tab[i][j-2] == 0)) count++;
      }
   }
   return count;
}

int main()
{
   int i,j;
   int tab[7][7];
   int coups;
   char c;
   for (i = 0; i < 7; i++)
      for (j = 0; j < 7; j++)
      {
         do {
            scanf("%c", &c);
         } while ((c == '\n') || (c == '\r'));
         tab[j][i] = c - '0';
      }
   coups = Solitaire(tab);
   printf("%d\n", coups);
   return 0;
}
